﻿using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;

namespace SerialPort热拔插测试
{
    class Program
    {
        static SerialPort sPort = new SerialPort();
        
        static void Main(string[] args)
        {
            string[] portNames = SerialPort.GetPortNames();
            sPort.PortName = portNames[0];
            sPort.BaudRate = 9600;
            sPort.Open();

            Thread.Sleep(100);

            sPort.Close();

            Console.ReadKey();
        }
    }
}
